﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
//using bdnt_pets_system.Resources;

namespace bdnt_pets_system_Entity
{
    [DataContract]
    public class Tbl_Employee : INotifyPropertyChanged
    {
        bool isValidate = true;
        [DataMember]
        public bool IsValidate
        {
            get { return isValidate; }
            set { isValidate = value; }
        }

        Int32 id;
        [DataMember]
        public Int32 Id
        {
            get { return id; }
            set { id = value; }
        }

        string empNo;
        [DataMember]
        [Required(ErrorMessage = "*")]
        public string EmpNo
        {
            get { return empNo; }
            set
            {
                if (empNo != value && isValidate)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "EmpNo" });
                    empNo = value;
                    this.OnPropertyChanged("EmpNo");
                }
                else empNo = value;
            }
        }

        string empName;
        [DataMember]
        [Required(ErrorMessage = "*")]
        public string EmpName
        {
            get { return empName; }
            set
            {
                if (empName != value && isValidate)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "EmpName" });
                    empName = value;
                    this.OnPropertyChanged("EmpName");
                }
                else empName = value;
            }
        }

        string email;
        [DataMember]
        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        string telephone;
        [DataMember]        
        public string Telephone
        {
            get { return telephone; }
            set
            {
                telephone = value;
            }
        }

        string deptNo;
        [DataMember]
        public string DeptNo
        {
            get { return deptNo; }
            set { deptNo = value; }
        }

        string loginName;
        [DataMember]
        [Required(ErrorMessage = "*")]
        public string LoginName
        {
            get { return loginName; }
            set
            {
                if (loginName != value && isValidate)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "LoginName" });
                    loginName = value;
                    this.OnPropertyChanged("LoginName");
                }
                else loginName = value;
            }
        }

        string loginPwd;
        [DataMember]
        [Required(ErrorMessage = "*")]
        public string LoginPwd
        {
            get { return loginPwd; }
            set {

                if (loginPwd != value && isValidate)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "LoginPwd" });
                    loginPwd = value;
                    this.OnPropertyChanged("LoginPwd");
                }
                else loginPwd = value;
            }
        }

        DateTime? createTime;
        [DataMember]
        public DateTime? CreateTime
        {
            get { return createTime; }
            set { createTime = value; }
        }

        DateTime? lastTime;
        [DataMember]
        public DateTime? LastTime
        {
            get { return lastTime; }
            set { lastTime = value; }
        }

        string roleStr;
        [DataMember]
        public string RoleStr
        {
            get { return roleStr; }
            set { roleStr = value; }
        }

        string roleIds;
        [DataMember]
        public string RoleIds
        {
            get { return roleIds; }
            set { roleIds = value; }
        }
        
        string stationIds;
        [DataMember]
        public string StationIds
        {
            get { return stationIds; }
            set { stationIds = value; }
        }

        Int32 stationId;
        [DataMember]
        public Int32 StationId
        {
            get { return stationId; }
            set { stationId = value; }
        }

        Int32 shopId;
        [DataMember]
        public Int32 ShopId
        {
            get { return shopId; }
            set { shopId = value; }
        }

        bool isShopManager;
        [DataMember]
        public bool IsShopManager
        {
            get { return isShopManager; }
            set { isShopManager = value; }
        }


        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string PropName)
        {
            if (PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(PropName));
            }
        }

    }
}
